package com.mchsdk.paysdk.bean;

import com.mchsdk.paysdk.utils.FileUtil;
import com.mchsdk.paysdk.utils.TextUtils;

/**
 * Created by zhujinzhujin
 * on 2017/1/22.
 */

public class ChannelAndGameInfo {

    private static final String TAG = "ChannelAndGameInfo";

    private static ChannelAndGameInfo instance;

    public static ChannelAndGameInfo getInstance() {
        if (null == instance) {
            instance = new ChannelAndGameInfo();
        }
        return instance;
    }

    private String channelId;
    private String channelName;
    private String gameId;
    private String gameName;
    private String gameAppId;

    private ChannelAndGameInfo(){
        FileUtil fileUtil = new FileUtil();
        channelId = fileUtil.getPromoteId();
        channelName = fileUtil.getPromoteAccount();
        gameId = fileUtil.getGameId();
        gameName = fileUtil.getGameName();
        gameAppId = fileUtil.getGameAppid();
    }

    public String getChannelId() {
        if(TextUtils.isEmpty(channelId)){
            channelId = SdkDomain.getInstance().getChannelId();
        }
        return channelId;
    }

    public void setChannelId(String channelId) {
        this.channelId = channelId;
    }

    public String getChannelName() {
        if(TextUtils.isEmpty(channelName)){
            channelName = SdkDomain.getInstance().getChannelName();
        }
        return channelName;
    }

    public void setChannelName(String channelName) {
        this.channelName = channelName;
    }

    public String getGameAppId() {
        if(TextUtils.isEmpty(gameAppId)){
            gameAppId = SdkDomain.getInstance().getGameAppId();
        }
        return gameAppId;
    }

    public void setGameAppId(String gameAppId) {
        this.gameAppId = gameAppId;
    }

    public String getGameId() {
        if(TextUtils.isEmpty(gameId)){
            gameId = SdkDomain.getInstance().getGameId();
        }
        return gameId;
    }

    public void setGameId(String gameId) {
        this.gameId = gameId;
    }

    public String getGameName() {
        if(TextUtils.isEmpty(gameName)){
            gameName = SdkDomain.getInstance().getGameName();
        }
        return gameName;
    }
//    public String getIs_Uc() {
//        if(TextUtils.isEmpty(gameName)){
//            gameName = SdkDomain.getInstance().getGameName();
//        }
//        return gameName;
//    }


    public void setGameName(String gameName) {
        this.gameName = gameName;
    }

    public boolean haveReadGameInfo(){
        if (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(gameName) ||
                android.text.TextUtils.isEmpty(gameAppId) ||
                android.text.TextUtils.isEmpty(channelId) ||
                android.text.TextUtils.isEmpty(channelName)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ChannelAndGameInfo{" +
                "channelId='" + getChannelId() + '\'' +
                ", channelName='" + getChannelName() + '\'' +
                ", gameId='" + getGameId() + '\'' +
                ", gameName='" + getGameName() + '\'' +
                ", gameAppId='" + getGameAppId() + '\'' +
                '}';
    }
}
